<?php

namespace app\admin\validate;

use \think\Validate;

/**
 *  角色名字不饿为空
 */


class Role extends Validate
{

    protected $rule = [
        'id' => 'require|number',
        'page' => 'require|number',
        'ids' => 'require',
        'rolename' => 'require',
        'role_id' => 'require',
        'auth_ids' => 'require',
        'status' => 'require|number',

    ];

    //定义验证提示
    protected $message = [
        'id.require' => 'ID 不能为空',
        'id.number' => 'ID 只能是数字',
        'page.require' => 'page 不能为空',
        'page.number' => 'page 只能是数字',
        'rolename.require' => '角色名称不能为空',
        'role_id.require' => '角色ID不能为空',
        'auth_ids.require' => '权限ID不能为空',
        'ids.require' => 'ids 不能为空',
        'status' => '状态码错误',
    ];

    //定义验证场景
    protected $scene = [
        'list' => ['page'],
        'save' => ['rolename','remark'],
        'detail' => ['id'],
        'remove' => ['id'],
        'del' => ['id'],
        'status' => ['ids','status'],
        'setAuth' => ['role_id','auth_ids'],
    ];


}
